home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 011 / screen.asm < prev    next >
Assembly Source File  |  1985-06-03  |  6KB  |  132 lines

  1. ;*********************************************************************
  2. ;  These routines are assembler interfaces to the Lattice vers 2.10  *
  3. ;  compiler.  They allow the programmer to do some of the necessary  *
  4. ;  screen manipulations such as clearing  the  screen,  setting the  *
  5. ;  cursor at a given location etc.  I will add more routines to the  *
  6. ;  package as time permits me to do so.                              *
  7. ;                                     *
  8. ;  The routines should be assembled and then linked with the linker  *
  9. ;  as explained in the lattice manual.  For example if you used the  *
  10. ;  clear screen routine in a c program called test the link command  *
  11. ;  would be:                                 *
  12. ;            link cs+test+screen,test,nul,lcs                        *
  13. ;  Other routines I plan to add are:                                 *
  14. ;      scr_clrl------------>clears the rest of the current line     *
  15. ;       scr_clrs------------>clears the rest of the screen           *
  16. ;       scr_scup------------>scrolls the screen up xcept top line    *
  17. ;       scr_scdn------------>scrolls screen down xcept for top line  *
  18. ;       scr_co-------------->writes a character to the screen        *
  19. ;       scr_ci-------------->inputs a character from the keyboard    *
  20. ;       scr_csts------------>inputs a character from keyboard and    *
  21. ;                            translates function and soft key values *
  22. ;       scr_csts------------>returns 0 if no character has been      *
  23. ;                            input.                                  *
  24. ;       scr_sinp------------>reads the screen and returns the char   *
  25. ;                            under the cursor                        *
  26. ;       scr_off------------->turns the cursor off                    *
  27. ;       scr_on-------------->turns the cursor on                     *
  28. ;  Many of you have probably guessed by now that I am converting     *
  29. ;  from DeSmet C to Lifeboat's Lattice C.  I initially had the       *
  30. ;  DeSmet C package and found it to be an excellent package to       *
  31. ;  learn the c language with.  I do think the Lattice C package is   *
  32. ;  a better package for the serious software developer however.  I   *
  33. ;  have found the Lifeboat people both easy to work with and help-   *
  34. ;  ful when I needed information.  I am told by many users on my     *
  35. ;  board that this is not the case with Microsoft who also markets   *
  36. ;  the Lattice C compiler.  In the future I plan to have a group of  *
  37. ;  assembler routines that function with the communications ports,   *
  38. ;  and maybe a set of graphics routines.  If you have suggestions or *
  39. ;  comments then I can be contacted at:                              *
  40. ;                    Lynn Long                                       *
  41. ;                    PC-Systems                                      *
  42. ;                    PO Box 471114                                   *
  43. ;                    Tulsa, OK 74147-1114                            *
  44. ;  or be reached at my BBS #                                         *                  
  45. ;                    Lynn Long                                       *
  46. ;                    Tulsa IBBS C-SIG                                *
  47. ;                    918-749-0718                                    *
  48. ;                    24 hours, 300/450/1200, XMODEM                  *
  49. ;                    Registration required                           *
  50. ;*********************************************************************
  51.     name    screen
  52.     include    dos.mac
  53.     pseg
  54. ;*********************************************************************
  55. ;  This routine clears the monitor.  It is called from Lattice C as  *
  56. ;  follows.                                 *
  57. ;              scr_cls();                                            *
  58. ;*********************************************************************
  59.     public    scr_cls
  60. scr_cls    proc    near
  61.     mov    ax,06
  62.     mov    bh,07
  63.     mov    cx,0000
  64.     mov    dx,184fh
  65.     int    10h
  66.     ret
  67. scr_cls    endp
  68.     public    scr_pos
  69. ;*********************************************************************
  70. ;  this routine will position the cursor at the specified location   *
  71. ;  location on the screen.  It is called from c as:                  *
  72. ;                  scr_pos(row,col)                                  *
  73. ;*********************************************************************
  74. scr_pos proc near
  75.     push    bp
  76.     mov    bp,sp
  77.      mov    ah,02
  78.     mov    bh,00
  79.     mov    dl,[bp+6]
  80.     mov    dh,[bp+4]
  81.      int    10h
  82.     pop    bp
  83.     ret
  84. scr_pos endp
  85.  
  86. ;*********************************************************************
  87. ;  this function turns the cursor off                                *
  88. ;*********************************************************************
  89.     public    scr_off
  90. scr_off proc    near
  91.     push    bp
  92.     mov    ah,15
  93.     int    10h
  94.     cmp    al,04
  95.     jc    text_off
  96.     cmp    al,7
  97.     jnz    no_cur
  98. text_off:
  99.     mov    cx,0f00h
  100.     mov    ah,1
  101.     int    10h
  102. no_cur:
  103.     pop    bp
  104.     ret
  105. scr_off endp    
  106. ;*********************************************************************
  107. ;  this function turns the cursor back on                            *
  108. ;*********************************************************************
  109.     public    scr_on
  110. scr_on    proc    near
  111.     push    bp
  112.     mov    ah,15
  113.     int    10h
  114.     mov    cx,0c0dh
  115.     cmp    al,7
  116.     jz    newcur
  117.     mov    cx,0607h
  118.     cmp    al,4
  119.     jc    newcur
  120.     jmp    back
  121. newcur:
  122.     mov    ah,1
  123.     int    10h         
  124. back:
  125.     pop    bp
  126.     ret
  127. scr_on    endp
  128.     endps
  129.     end
  130.  
  131.